﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using PlanoAulaHelper.Properties;
using System.IO;
using System.Configuration;

namespace PlanoAulaHelper
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if ( Settings.Default.Geral.Contains("|DataDirectory|") )
            {
                Settings.Default.PropertyValues["Geral"].PropertyValue =
                Settings.Default.Geral.Replace("|DataDirectory|",
                    Path.GetDirectoryName(Application.ExecutablePath));
                Settings.Default.Save();
            }
            dbContext dc = new dbContext();
            try
            {
                if (!dc.DatabaseExists())
                {
                    dc.CreateDatabase();
                }
            }
            catch(Exception erro)
            {
                throw erro;
            }
            Application.Run(new Main());
            //Application.Run(new Form1());
        }
    }
}
